]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Fix allocation implementations for ShellStack and ShellDrawingArea
authorColin Walters <walters@verbum.org>
Thu, 27 Aug 2009 03:15:47 +0000 (23:15 -0400)
committerColin Walters <walters@verbum.org>
Thu, 27 Aug 2009 17:11:19 +0000 (13:11 -0400)
In both, using our allocation directly for the child is wrong; we
should create a new allocation that's our width and height.

In ShellDrawingArea, also need to chain up to parent.

src/shell-drawing-area.c
src/shell-stack.c

index 78a7e94e8138b7dc04d0f2ea05b28e80d96cbd54..04505bb50be5f41248ae15a3a669a104235dc979 100644 (file)
@@ -40,8 +40,18 @@ shell_drawing_area_allocate (ClutterActor          *self,
   ShellDrawingArea *area = SHELL_DRAWING_AREA (self);
   int width = box->x2 - box->x1;
   int height = box->y2 - box->y1;
+  ClutterActorBox child_box;
 
-  clutter_actor_allocate (CLUTTER_ACTOR (area->priv->texture), box, flags);
+  /* Chain up directly to ClutterActor to set actor->allocation.  We explicitly skip our parent class
+   * ClutterGroup here because we want to override the allocate function. */
+  (CLUTTER_ACTOR_CLASS (g_type_class_peek (clutter_actor_get_type ())))->allocate (self, box, flags);
+
+  child_box.x1 = 0;
+  child_box.x2 = width;
+  child_box.y1 = 0;
+  child_box.y2 = height;
+
+  clutter_actor_allocate (CLUTTER_ACTOR (area->priv->texture), &child_box, flags);
   if (width > 0 && height > 0)
     {
       clutter_cairo_texture_set_surface_size (area->priv->texture,
index e0a5b4bc8d1d9c6ff44f4e05cbd771f317660ac1..ea3ec2c33acca2cfbb90d5232a85abc634d1ebf2 100644 (file)
@@ -24,15 +24,25 @@ shell_stack_allocate (ClutterActor           *self,
                       ClutterAllocationFlags  flags)
 {
   GList *children, *iter;
+  float width, height;
 
-  /* chain up to set actor->allocation */
+  width = box->x2 - box->x1;
+  height = box->y2 - box->y1;
+
+  /* Chain up directly to ClutterActor to set actor->allocation.  We explicitly skip our parent class
+   * ClutterGroup here because we want to override the allocate function. */
   (CLUTTER_ACTOR_CLASS (g_type_class_peek (clutter_actor_get_type ())))->allocate (self, box, flags);
 
   children = clutter_container_get_children (CLUTTER_CONTAINER (self));
   for (iter = children; iter; iter = iter->next)
     {
       ClutterActor *actor = CLUTTER_ACTOR (iter->data);
-      clutter_actor_allocate (actor, box, flags);
+      ClutterActorBox child_box;
+      child_box.x1 = 0;
+      child_box.x2 = width;
+      child_box.y1 = 0;
+      child_box.y2 = height;
+      clutter_actor_allocate (actor, &child_box, flags);
     }
   g_list_free (children);
 }